package com.wjb.xietong.server;

import org.json.JSONException;
import org.json.JSONObject;

import com.wjb.xietong.util.IDs;
import com.wjb.xietong.util.LogD;

public abstract class BaseResponseDataParse {
	
	public boolean checkRespCode(JSONObject response){
		if(null != response){
			try {
				if(response.has(IDs.ERROR_CODE)){
					if(!IDs.RESPONSE_CODE_000.equals(response.getString(IDs.ERROR_CODE))){
						return false;
					}
				}
			} catch (JSONException e) {
				LogD.output("Exception:" + e.getMessage());
				return false;
			}
		}
		return true;
	}
	
	public boolean checkValueIsNULL(String value){
		if(null != value){
			String var = value.toUpperCase();
			if(!"NULL".equals(var)){
				return false;
			}
		}
		return true;
	}
	
	public abstract void initData(); 
	
	public abstract boolean parseJsonObj(JSONObject response);
}
